<template>
  <div class="right-container">
    <h3>Right 组件</h3>
    <hr />
    <h4>{{ messageLeft }}</h4>
    <MyCount :init="3"></MyCount>
  </div>
</template>

<script>
  //1.
   import bus from './eventBus.js'
export default {
  data() {
    return {
      messageLeft:""
    }
  },
  // 这是现成的解决方案
  created(){
    //2.绑定自定义事件
    bus.$on('share', (val)=>{
      this.messageLeft = val
      console.log('触发了left', val)
    })
  }
}
</script>

<style lang="less" >
.right-container {
  padding: 0 20px 20px;
  background-color: rgb(162, 250, 135);
  min-height: 250px;
  flex: 1;
}
</style>
